﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class SystemManage_SystemParamConfig_MoneyLimit : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Check.CheckPermission("100100117");
        if (!IsPostBack)
        {
            page_init();
        }
    }
    public Model.SYSPARAM sys_model
    {
        get
        {
            if (ViewState["Limit"] != null)
            {
                return (Model.SYSPARAM)ViewState["Limit"];
            }
            else
            {
                return null;
            }
        }
        set
        {
            ViewState["Limit"] = value;
        }

    }
    private void page_init()
    {
        sys_model = new BLL.SYSPARAM().GetModel("016");
        if (sys_model != null)
        {
            TextBox1.Text = sys_model.SP_PARAM19;
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (!Check.CheckPermission("100100117", "00017"))
        {
            Share.Alert(this.Page, "无权操作"); return;
        }
        try
        {
            if (sys_model != null)
            {
                sys_model.SP_PARAM19 = TextBox1.Text;
                if (new BLL.SYSPARAM().Update(sys_model))
                {
                    BLL.Common.Alert(this, "设置成功");
                }
                else
                {
                    BLL.Common.Alert(this, "设置失败");
                }
            }
            else
            {
                sys_model.SP_TYPE = "016";
                sys_model.SP_PARAM19 =TextBox1.Text;
                if (new BLL.SYSPARAM().Add(sys_model).Length > 1)
                {
                    BLL.Common.Alert(this, "设置成功");
                }
                else
                {
                    BLL.Common.Alert(this, "设置失败");
                }
            }
        }
        catch (Exception ex)
        {
            BLL.Common.Alert(this, "充值金额必须是正浮点数");
        }

    }
    protected void btnCancel_Click(object sender, EventArgs e)
    {
        Response.Redirect("MoneyLimit.aspx");
    }
}
